package service;

import entity.User;

import java.util.List;

import dao.UserDao;

public class UserService {
	UserDao userDao=new UserDao();
	
	public boolean  queryUser(User user) {
		return userDao.queryUser(user);
	}
	public boolean addUser(User user) {
		if(!userDao.queryUser(user)) {
			return userDao.addUser(user);
		}else {
			return false;
		}
	}
	public boolean updateUserById(int id,User user) {
		 
		if(user!=null) {
			return userDao.updateUserById(id, user);
		}else {
			return false;
		}
		
	}
	public boolean deleteUserById(int id) {
		User user=userDao.queryById(id);
		if(user!=null) {
			return userDao.deleteUserById(id);
		}else {
			return false;
		}
		
	}
	
	public User queryUserById(int id) {
		return userDao.queryById(id);
	}
	public List<User> queryAllUser(){
		return userDao.queryAllUser();
	}
	public List<User> queryUserByid(int id){
		return userDao.queryUserByid(id);
	}
	public int getPageCount() {
		return userDao.getPageCount();
	}
}
